<%@ page language="java" import="java.util.*,java.io.*"  pageEncoding="utf-8"%>  
<%  
String path = request.getContextPath();  
String basePath = request.getScheme() + "://"  
    + request.getServerName() + ":" + request.getServerPort()  
    + path + "/";  
%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/util.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BILL PRINT</title>

</head>
<body onUnload="myClose()">
<%  
   out.clear();  
   out = pageContext.pushBody();  
   response.setContentType("application/pdf");  
   try {
	  String filename = request.getParameter("filename");
    //E:\\apache-tomcat-7.0.62\\webapps\\led2 生产环境目录
	  //D:\\apache-tomcat-7.0.55\\webapps\\led2 本地测试目录
    String strPdfPath = new String("D:\\apache-tomcat-7.0.55\\webapps\\led2"+ filename);
    //判断该路径下的文件是否存在  
    File file = new File(strPdfPath);  
    if (file.exists()) {  
     DataOutputStream temps = new DataOutputStream(response.getOutputStream());  
     DataInputStream in = new DataInputStream(new FileInputStream(strPdfPath));  
  
     byte[] b = new byte[2048];  
     while ((in.read(b)) != -1) {  
      temps.write(b);  
      temps.flush();  
     }  
  
     in.close();  
     temps.close();  
    } else {  
     out.print(strPdfPath + " 文件不存在!");  
    }  
  
   } catch (Exception e) {  
    out.println(e.getMessage());  
   }  
%> 
</body>


</html>

